<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue.js学习</title>
    <script src="https://unpkg.com/vue/dist/vue.js"></script>   <!--引入vue.js-->
</head>
<body>
    <div id="xue">
        <p>{{message}}</p>
        <p>{{message | tocapital }}</p>
        <hr>
        <p>来个百分比 ：  {{num}} ({{num | topercentage}})。</p>
    </div>
    <script>
        var hehe = new Vue({
            el: '#xue',
            data: {
                message: 'ni hao',
                num: 0.3
            },
            filters: {
                tocapital: function(value){
                    return value.toUpperCase();  //toUpperCase() 变大写的函数
                },
                topercentage: function(value){
                    return value * 100 + '%';
                },
            },
        });
    </script>
</body>
</html>